package org.bp.spider.only;

import java.util.List;

import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet;
import org.bp.spider.util.ExcelInsertDataEvent;
import org.bp.spider.util.ExcelUtils;

public class StoreCompany {
	public void storeCompany(List<Company> list) throws Exception{
		String[] titleRow = {"公司名","法人代表","电话","邮箱","地址"};
		ExcelUtils.writer("R:\\temp\\1.xls","清单", titleRow,5, new ExcelInsertDataEvent() {
			@Override
			public Row insertData(Sheet sheet,int rowNum) {
				Row row = null;
				for (int i = 0; i < list.size(); i++) {
					row = sheet.createRow(i + rowNum);
					row.setHeight((short) 500);
					row.createCell(0).setCellValue((list.get(i)).getName());
					row.createCell(1).setCellValue((list.get(i)).getBoss());
					row.createCell(2).setCellValue((list.get(i)).getPhone());
					row.createCell(3).setCellValue((list.get(i)).getEmail());
					row.createCell(4).setCellValue((list.get(i)).getAddress());
				}
				return row;
			}
		});
	
	
	}
}
